//
//  PasswordViewController.m
//  Diary
//
//  Created by lanou3g on 16/1/21.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "PasswordViewController.h"
#import "AppDelegate.h"
#import "BackPasswordViewController.h"
@interface PasswordViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    
    NSArray *setNameArray;
    NSArray *setImageArray;
    
}

@end

@implementation PasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:20/255.0 green:100/255.0 blue:200/255.0 alpha:0.5];
    setNameArray = [NSArray array];
    setNameArray = @[@"创建手势密码",@"修改手势",@"清除手势",@"找回密码"];
    setImageArray = [NSArray array];
    setImageArray = @[@"设置手势.png",@"修改.png",@"清除.png",@"找回密码.png"];
    
    UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
    [self.view addSubview:tableView];
    tableView.backgroundColor = [UIColor clearColor];
    tableView.dataSource = self;
    tableView.delegate = self;
    
}



#pragma mark - Table view data source


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
   
    return 4;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
       
    }
    
    cell.textLabel.text = setNameArray[indexPath.row];
    cell.backgroundColor = [UIColor clearColor];
    cell.imageView.image = [UIImage imageNamed:setImageArray[indexPath.row]];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    AppDelegate *ad = (AppDelegate*)[UIApplication sharedApplication].delegate;
    switch (indexPath.row) {
        case 0:
            [ad showLLLockViewController:LLLockViewTypeCreate];
            break;
        case 1:
            [ad showLLLockViewController:LLLockViewTypeModify];
            break;
        case 2:
            [ad showLLLockViewController:LLLockViewTypeClean];
            break;
            
        default:
            
            break;
    }
    if (indexPath.row == 3) {
        
        BackPasswordViewController *backPasswordVC = [[BackPasswordViewController alloc]init];
        [self.navigationController pushViewController:backPasswordVC animated:YES];
        
        
    }
    
}


@end
